# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=dga-detection
pkgver=78.0a3186e
pkgrel=5
pkgdesc='DGA Domain Detection using Bigram Frequency Analysis.'
groups=('blackarch' 'blackarch-recon')
arch=('any')
url='https://github.com/philarkwright/DGA-Detection'
license=('BSD')
depends=('python2' 'python2-argparse' 'python2-tldextract' 'python2-scapy'
         'python2-alexa-top-sites' 'python2-pushbullet.py' 'python2-scipy'
         'python2-websocket-client')
makedepends=('git')
source=("$pkgname::git+https://github.com/philarkwright/DGA-Detection")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENCE "$pkgdir/usr/share/licenses/$pkgname/LICENCE"

  rm README.md LICENCE

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 dga_detection.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

